package com.example.myapplication2

import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.widget.Button
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

class MainActivity2 : BaseActivity() {
    private val TAG = "TestActivity2"


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        Log.d(TAG, "onCreate: " + this.toString());
        Log.d(TAG, "onCreate: ${intent.getStringExtra("p1")}")

        setContentView(R.layout.activity_main2)
//        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
//            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
//            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
//            insets
//        }
//        Log.d(TAG, "onCreate: $intent.getStringExtra(“ex”)")
        val btn_start = findViewById<Button>(R.id.button3)
        btn_start.setOnClickListener {
            var intent = Intent()
            intent.setClass(this, MainActivity::class.java)
            startActivity(intent)
        }


    }

    companion object {
        fun actionStart(context: Context, data1: String, data2: String) {
            var intent = Intent(context, MainActivity2::class.java)
            intent.putExtra("p1", "cy")
            intent.putExtra("p2", "gd")
            context.startActivity(intent)
        }
    }


    override fun onStart() {
        super.onStart()
        Log.d(TAG, "onStart: $this")
    }

    override fun onResume() {
        super.onResume()
        Log.d(TAG, "onResume: $this")
    }

    override fun onPause() {
        super.onPause()
        Log.d(TAG, "onPause: $this")
    }

    override fun onStop() {
        super.onStop()
        Log.d(TAG, "onStop: $this")
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d(TAG, "onDestroy: $this")
    }

    override fun onRestart() {
        super.onRestart()
        Log.d(TAG, "onRestart: $this")
    }

}